﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace DataAccess.Config
{
    public class ConfigDAL
    {
        private SQLDataAccess db;
        public ConfigDAL()
        {
            db = new SQLDataAccess();
        }
        public DataTable getConfigList(string[] stringkey)
        {
            string keys = "";
            int stringkeyLen=stringkey.Length;
            for (int i = 0; i < stringkeyLen;i++ )
            {
                if (i != stringkeyLen - 1)
                {
                    keys += "'"+stringkey[i]+ "',";
                }
                else
                {
                    keys += "'"+stringkey[i]+"'";
                }
            }

            return db.exeSelect("select * from Config where Ckey in ("+keys+")");
        }
        public DataTable getConfigKey(string key)
        {
               return db.exeSelect("select * from Config where Ckey='" + key + "'");
        }
        public DataTable getConfigGroup(string groupName)
        {
            return db.exeSelect("select * from Config where ConfigGroup='" + groupName + "'");
        }
    }
}
